package com.interest.time.service;

import java.util.Date;

import javax.management.timer.Timer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.interest.bean.AccessToken;
import com.interest.time.MyTimer;
import com.interest.time.MyTimerTask;
import com.interest.util.SignUtil;

public class GetTokenTimerService  extends MyTimerTask{
	private static Logger logger = LoggerFactory.getLogger(GetTokenTimerService.class);
	private static String appId = "wx08fc2ab85b0b69d7";
	private static String appSecret = "768b173c2426b8f6562d9fabab8e51d9";
	public  static AccessToken accessToken = null;
	static{
		new MyTimer().schedule(new GetTokenTimerService(), new Date(), 1000*60*60*2);
	}
	@Override
	public void task() {
		logger.info("定时任务开始了。。。。");
		accessToken = SignUtil.getAccessToken(appId, appSecret);
		logger.info("获取到accessToken :{}",accessToken);
	}

}
